<?php
/**
 * Created by PhpStorm.
 * User: zouhua
 * Date: 2017/6/25
 * Time: 16:41
 */

namespace app\controllers;


use app\components\WebAuthController;
use app\models\ActivityApply;
use yii\helpers\Url;

class ActivityApplyController extends WebAuthController {

    public function actionAllow($id) {
        $remark = $this->getParam('remark', '');
        return ActivityApply::statusAllowAndDeny($id, $this->user, ActivityApply::STATUS_ALLOW, $remark);
    }

    public function actionDeny($id) {
        $remark = $this->getParam('remark', '');
        return ActivityApply::statusAllowAndDeny($id, $this->user, ActivityApply::STATUS_DENY, $remark);
    }

    public function afterAction($action, $result) {
        if (is_array($result) && isset($result['data'])) {
            $result['redirect'] = Url::to(['user/apply-list']);
        }
        return parent::afterAction($action, $result);
    }

}